package com.xyauto.theme.base

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.xyauto.theme.base.internal.IBaseView
import com.xyauto.theme.utils.AutoUtils
import com.xyauto.theme.utils.DialogUtils


/**
 * Created by gongziyi on 2021/5/13 11:03.
 */
abstract class BaseActivity : AppCompatActivity(), IBaseView {


    protected open fun onGetData() = Unit

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(getLayoutId())
        AutoUtils.auto(this)
        initView(savedInstanceState)
        initData()
        initListener()
        onGetData()
    }


    override fun showError(msg: String, code: Int) {
        dismissLoadingDialog()
//        ToastUtils.showLong(msg)
    }

    override fun showLoadingDialog(msg: String?, isCancelable: Boolean) {
        DialogUtils.showLoadingDialog(this, msg, isCancelable);
    }

    override fun dismissLoadingDialog() {
        DialogUtils.dismiss();
    }


}